<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditSourceCodeTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:outputScript name="js/jsfunctions.js" />
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.EditSourceCodeLabel_hourlyRate}" for="hourlyRate" />
                    <h:inputText id="hourlyRate" value="#{sourceCodeController.selected.hourlyRate}" title="#{bundle.EditSourceCodeTitle_hourlyRate}" required="true" requiredMessage="#{bundle.EditSourceCodeRequiredMessage_hourlyRate}"/>

                    <h:outputLabel value="#{bundle.EditSourceCodeLabel_startDate}" for="startDate" />
                    <h:inputText id="startDate" value="#{sourceCodeController.selected.startDate}" title="#{bundle.EditSourceCodeTitle_startDate}" required="true" requiredMessage="#{bundle.EditSourceCodeRequiredMessage_startDate}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:inputText>

                    <h:outputLabel value="#{bundle.EditSourceCodeLabel_expireDate}" for="expireDate" />
                    <h:inputText id="expireDate" value="#{sourceCodeController.selected.expireDate}" title="#{bundle.EditSourceCodeTitle_expireDate}" required="true" requiredMessage="#{bundle.EditSourceCodeRequiredMessage_expireDate}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:inputText>
                    <c:if test="#{sourceCodeController.selected.subcontResName.subResId != 1}">
                        <h:outputLabel value="#{bundle.EditSourceCodeLabel_subcontResName}" for="subcontResName" />
                        <h:selectOneMenu id="subcontResName" value="#{sourceCodeController.selected.subcontResName}" title="#{bundle.EditSourceCodeTitle_subcontResName}" required="true" requiredMessage="#{bundle.EditSourceCodeRequiredMessage_subcontResName}">
                            <f:selectItems value="#{subcontarctorResourcesController.itemsAvailableSelectOne}"/>
                        </h:selectOneMenu>
                    </c:if>
                    <h:outputLabel value="#{bundle.EditSourceCodeLabel_role}" for="role" />
                    <h:selectOneMenu id="role" value="#{sourceCodeController.selected.role}" title="#{bundle.EditSourceCodeTitle_role}" required="true" requiredMessage="#{bundle.EditSourceCodeRequiredMessage_role}">
                        <f:selectItems value="#{jobsTitlesController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>

                    <h:outputLabel value="#{bundle.EditSourceCodeLabel_projectCode}" for="projectCode" />
                    <h:selectOneMenu id="projectCode" value="#{sourceCodeController.selected.projectCode}" title="#{bundle.EditSourceCodeTitle_projectCode}" required="true" requiredMessage="#{bundle.EditSourceCodeRequiredMessage_projectCode}">
                        <f:selectItems value="#{projectsController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>

                    <h:outputLabel value="Activity Code" for="activityCode" />
                    <h:selectOneMenu id="activityCode" value="#{sourceCodeController.selected.activityCode}" title="Activity Code" required="true">
                        <f:selectItems value="#{sourceCodeController.activityCode}"/>
                    </h:selectOneMenu>

                    <c:if test="#{sourceCodeController.selected.employee.empId != 1}">
                        <h:outputLabel value="#{bundle.EditSourceCodeLabel_employee}" for="employee" />
                        <h:selectOneMenu id="employee" value="#{sourceCodeController.selected.employee}" title="#{bundle.EditSourceCodeTitle_employee}" required="true" requiredMessage="#{bundle.EditSourceCodeRequiredMessage_employee}">
                            <f:selectItems value="#{employeesController.itemsAvailableSelectOne}"/>
                        </h:selectOneMenu>
                    </c:if>

                    <h:outputLabel value="#{bundle.EditSourceCodeLabel_currency}" for="currency" />
                    <h:selectOneMenu id="currency" value="#{sourceCodeController.selected.currency}" title="#{bundle.EditSourceCodeTitle_currency}" required="true" requiredMessage="#{bundle.EditSourceCodeRequiredMessage_currency}">
                        <f:selectItems value="#{currenciesController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>

                </h:panelGrid>
                <h:commandButton type="submit" action="#{sourceCodeController.update}" value="#{bundle.EditSourceCodeSaveLink}"/>
                <h:commandButton type="submit" action="View" value="#{bundle.EditSourceCodeViewLink}" immediate="true"/>
            </h:form>

            <h:form>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <h:commandButton type="submit" action="#{sourceCodeController.prepareList}" value="#{bundle.EditSourceCodeShowAllLink}" immediate="true"/>
                <h:button value="Back to Home" outcome="/index" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
